﻿CREATE FUNCTION [dbo].[Collection_NotePhoneLast](
	@LoanID int
)RETURNS sysname AS BEGIN
RETURN(
SELECT  TOP 1 Phone   
FROM        t_Note
WHERE     (LoanID = @LoanID) AND Phone > ''
ORDER BY NoteDate DESC
)
END



